import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class EditMemberDetailsFrame extends JFrame{

    JLabel memberName = new JLabel();
    JLabel memberPassword = new JLabel();
    JLabel memberCardDetails = new JLabel();
    JTextField tmemberName = new JTextField();
    JTextField tmemberPassword = new JTextField();
    JTextField tmemberCardDetails = new JTextField();
    JButton bUpdate = new JButton( "Update" );

    EditMemberDetailsFrame(){
        Image bGround = ReadImage.getImage( "http://wallpapers.wallbase.cc/rozne/wallpaper-389121.jpg" );
        Browser bGPanel = new Browser( bGround );
        add( bGPanel );

        memberName.setBounds(20,50,150,20);
        memberPassword.setBounds(20,80,150,20);
        memberCardDetails.setBounds(20,110,150,20);
        tmemberName.setBounds(200,80,150,20);
        tmemberPassword.setBounds(200,110,150,20);
        tmemberCardDetails.setBounds(200,140,175,20);
        bUpdate.setBounds(200,400,100,20);

        bGPanel.add( memberName );
        bGPanel.add( memberPassword );
        bGPanel.add( memberCardDetails );
        bGPanel.add( tmemberName );
        bGPanel.add( tmemberPassword );
        bGPanel.add( tmemberCardDetails );
        bGPanel.add( bUpdate );

        setSize(750,500);
        setVisible(true);
        clickUpdate();
    }

    public void clickUpdate(){
        bUpdate.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent ae ){
                Long argument;
                if( tmemberCardDetails.getText().equals("") ){
                    argument = 0L;
                }else{
                    argument = Long.parseLong( tmemberCardDetails.getText());
                }
                AdminUpdates.editMemberDetails( EditMemberFrame.userName.getText() ,tmemberName.getText(), tmemberPassword.getText(), argument  );
            }
        });
    }


}

